package cn.fanyamin.jms;

import cn.fanyamin.util.io.ConsoleUtils;

public class JmsServiceTrier {

    public static void main(String[] args) {
       JmsService jmsSvc = new JmsService(); 
       //<property name="mqConfigFile" value="xbean:activemq.xml" />
       //<property name="mqDataDir" value="${activemq.broker.datadir}" />
       //<property name="mqLockFile" value="kahadb/lock" />
       jmsSvc.setMqConfigFile("xbean:activemq.xml");
       jmsSvc.setMqDataDir("./storage");
       jmsSvc.setMqLockFile("kahadb/lock");
       try {
        jmsSvc.init();
        jmsSvc.start();
        System.out.print("exit(y/n)?>");
        String answer = "y";
        do {
            answer = ConsoleUtils.getStringFromConsole();
        } while(!"y".equalsIgnoreCase(answer));
        
        System.out.println("byebye");
        jmsSvc.stop();
        jmsSvc.clean();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } 
    }

}
